﻿#include "addstudent.h"
#include "ui_addstudent.h"
#include <QMessageBox>

AddStudent::AddStudent(QWidget* parent)
    : QDialog(parent)
    , ui(new Ui::AddStudent)
{
    ui->setupUi(this);
    ui->stuBirthdayDateEdit->setCalendarPopup(true);
    connect(ui->pushButton, &QPushButton::clicked, this, [=]() {
        if (ui->stuNameLineEdit->text() == "") {
            QMessageBox::warning(this, QStringLiteral("警告"), QStringLiteral("姓名不能为空,请核对后添加!"));
            return;
        }
        m_stuName = ui->stuNameLineEdit->text();
        m_stuNum = ui->stuNumLineEdit->text();
        m_stuSex = ui->stuSexComboBox->currentText();
        m_stuBirthday = ui->stuBirthdayDateEdit->text();
        m_stuHigh = ui->stuHighSpinBox->text();
        accept();
    });
}

AddStudent::~AddStudent()
{
    delete ui;
}
